﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Interactivity = System.Windows.Interactivity;
namespace XamlingCore.WP.Controls.Behavior.Manipulation
{
    public class CaptureSwipeBehavior : Interactivity.TriggerAction<UIElement>
    {
        public CaptureSwipeBehavior()
        {

        }

        protected override void Invoke(object parameter)
        {
            
        }

        protected override void OnDetaching()
        {
            AssociatedObject.ManipulationCompleted -= new EventHandler<ManipulationCompletedEventArgs>(AssociatedObject_ManipulationCompleted);
        }

        protected override void OnAttached()
        {
            AssociatedObject.ManipulationCompleted += new EventHandler<ManipulationCompletedEventArgs>(AssociatedObject_ManipulationCompleted);
        }

        void AssociatedObject_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
        {
            if (e.ManipulationContainer == AssociatedObject)
            {
                var manip = e.TotalManipulation;
                if (manip.Translation.X < -100 &&
                    (manip.Translation.Y > -25 &&
                     manip.Translation.Y < 25))
                {

                }
            }
        }
    }
}
